package cn.itcast.web.controller;

import cn.itcast.domain.system.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
public abstract class BaseController {
    @Autowired
    protected HttpServletRequest request;
    @Autowired
    protected HttpServletResponse response;
    @Autowired
    protected HttpSession session;

    //返回获取企业id
    public String getLoginCompanyId(){
        return getLoginUser().getCompanyId();
    }


    //返回获取企业名称
    public String getLoginCompanyName(){
        return getLoginUser().getCompanyName();
    }

    //获取登录用户
    public User getLoginUser(){
        return (User) session.getAttribute("loginInfo");
    }
}
